// TextRenderer.h
//
#ifndef TEXTRENDERER_ONCE
#define TEXTRENDERER_ONCE

#include "Framework_Exports.h"


#include "Math/Math.h"
#include "Math/Box.h"
#include "Color.h"

#include <list>
#include <string>


namespace OpenGL{

// *************************
// *************************
struct TextTag
{
	std::string _text;

	Math::dvec3 _worldPos;
	Math::dvec3 _screenPos;
	Math::box3  _box;
	Color		_color;
	double      _angle;
	double      _size;
	bool        _visible;
	int         _alignment;

	TextTag( const std::string &text, const Math::dvec3 &worldPos, const Color &color, double size, double angle, int alignment )
	: _text(text),_worldPos(worldPos),_color(color),_angle(angle), _size(size), _alignment(alignment), _visible(false) {}
};
// *************************
// *************************

class Renderer;


class FWK_API TextRenderer
{
public:
	enum TextAlignment { AlignLeft=0, AlignCenter, AlignRight };

private:
	std::list<TextTag>	_tags;
	Renderer		   *_renderer; // weak pointer to the renderer
	Math::box3          _box;


public:
	TextRenderer( Renderer *r );
	~TextRenderer();

	//void setFonts( Font *f );
	void addTag( const TextTag &tag );
	void draw();

	void update();
	Math::box3 boundingBox() const { return _box; }

	bool isEmpty() const;
};

}



#endif